<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
	<title>表单页面</title>
	<link href="/lib/pearadmin/component/pear/css/pear.css" rel="stylesheet">
	<link href="/css/sitesmanager.css" rel="stylesheet">
</head>
<body class="pear-container">
	<div class="body-card layui-card padding">
		<form id="saveSite" class="layui-form" action="javascript:void(0);">
			<div class="layui-form-item">
				<label class="layui-form-label"><span class="color-warn">*</span>
					站点名称</label>
				<div class="layui-input-inline">
					<input type="text" name="siteName" placeholder="请输入站点名称" lay-verify="required" class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label"><span class="color-warn">*</span>
					站点标识</label>
				<div class="layui-input-inline">
					<input type="text" name="siteSign" placeholder="请输入站点标识" lay-verify="required" class="layui-input">
				</div>
				<div class="layui-form-mid layui-word-aux">只能是英文字母和数字</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">站点域名</label>
				<div class="layui-input-inline">
					<input type="text" name="siteUrl" value="" class="layui-input">
				</div>
				<div class="layui-form-mid layui-word-aux">站点部署域名，读取配置文件中的值，需要在配置文件中维护</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label"><span class="color-warn">*</span>
					图片大小</label>
				<div class="layui-input-inline">
					<input type="text" name="imgMaxSize" placeholder="请输入图片上传大小限制" value="" lay-verify="required|number" class="layui-input">
				</div>
				<div class="layui-form-mid layui-word-aux">支持单个图片的最大大小值，单位M</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label"><span class="color-warn">*</span>
					文件大小</label>
				<div class="layui-input-inline">
					<input type="text" name="fileMaxSize" placeholder="请输入文件上传大小限制" value="" lay-verify="required|number" class="layui-input">
				</div>
				<div class="layui-form-mid layui-word-aux">支持单个文件的最大大小值，单位M</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label"><span class="color-warn">*</span>
					视频大小</label>
				<div class="layui-input-inline">
					<input type="text" name="videoMaxSize" placeholder="请输入视频上传大小限制" value="" lay-verify="required|number" class="layui-input">
				</div>
				<div class="layui-form-mid layui-word-aux">支持单个视频的最大大小值，单位M</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label"><span class="color-warn">*</span>
					图片格式</label>
				<div class="layui-input-inline">
					<input type="text" name="imgSuffix" placeholder="请输入图片上传支持格式" value="" lay-verify="required" class="layui-input">
				</div>
				<div class="layui-form-mid layui-word-aux">支持图片后缀，以|分割</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label"><span class="color-warn">*</span>
					文件格式</label>
				<div class="layui-input-inline">
					<input type="text" name="fileSuffix" placeholder="请输入文件上传支持格式" value="" lay-verify="required" class="layui-input">
				</div>
				<div class="layui-form-mid layui-word-aux">支持文件后缀，以|分割</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label"><span class="color-warn">*</span>
					视频格式</label>
				<div class="layui-input-inline">
					<input type="text" name="videoSuffix" placeholder="请输入视频上传支持格式" value="" lay-verify="required" class="layui-input">
				</div>
				<div class="layui-form-mid layui-word-aux">支持视频后缀，以|分割</div>
			</div>
			<div class="layui-form-item" pane>
				<label class="layui-form-label">访问日志</label>
				<div class="layui-input-inline">
					<input type="checkbox" name="accessLog" value="1" lay-skin="switch" lay-text="开启|关闭">
				</div>
				<div class="layui-form-mid layui-word-aux">开启后将记录网站访问情况</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">SEO标题</label>
				<div class="layui-input-block">
					<input type="text" name="siteTitle" placeholder="请输入SEO标题" class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">SEO关键字</label>
				<div class="layui-input-block">
					<input type="text" name="siteKeys" placeholder="请输入SEO关键字" class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">SEO描述</label>
				<div class="layui-input-block">
					<input type="text" name="siteDes" placeholder="请输入SEO描述" class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<div class="layui-input-block">
					<button type="button" class="pear-btn pear-btn-primary" lay-submit lay-filter="siteForm">立即提交</button>
					<button type="reset" class="pear-btn">重置</button>
				</div>
			</div>
		</form>
	</div>
	
	<script src="/lib/pearadmin/component/layui/layui.js"></script>
	<script src="/lib/pearadmin/component/pear/pear.js"></script>
	<script>
		layui.use([ 'form', 'element', 'popup'], function() {
			var form = layui.form;
			var element = layui.element;
			var popup = layui.popup;
			var $ = layui.$;//使用layui内置的jQuery
			
			//表单提交
			form.on('submit(siteForm)', function(data) {
				// 验证：表单字段设置属性，自动验证
				// 提交
				var $form = $("#saveSite");
				$.post("/site/saveSite", $form.serialize(), function(data){
					if("1"==data.state){
						popup.success("保存成功", function() {
							//当你在iframe页面关闭自身时
							var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
							parent.layer.close(index); //再执行关闭
						});
					} else {
						popup.failure(data.msg);
					}
				});
				return false;
			});
		});
	</script>
</body>
</html>
